|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jme3.app.state.AbstractAppState
ga.view.appstate.RootNodeState
ga.view.appstate.SceneState
ga.view.billard.BillardEvaluationState<T>
T - The generic type of the individuals.public class BillardEvaluationState<T extends IAgeIndividual<T>>
This interactive evaluator is a special case for direct selection.
| Nested Class Summary | |
|---|---|
private class |
BillardEvaluationState.CenteringListener
Key listener to toggle centering behavior. |
private class |
BillardEvaluationState.ClickListener
Mouse listener to recognize clicks on objects. |
private class |
BillardEvaluationState.DebugListener
Key listener to toggle debug display. |
private class |
BillardEvaluationState.PausedListener
Key listener to toggle pause. |
| Field Summary | |
|---|---|
private ISIGA<T> |
algorithm
|
private com.jme3.bullet.BulletAppState |
bulletAppState
|
private boolean |
debug
|
private BillardEvaluationState.ClickListener |
dragListener
|
private IIndividualFactory<T> |
factory
|
private java.util.List<EvaluationListener<T>> |
listeners
|
private static java.util.logging.Logger |
LOGGER
|
private MenuListener |
menuListener
|
private java.util.Map<T,BillardObjectNode<T>> |
nodeMap
|
private com.jme3.scene.Node |
objectsNode
|
private boolean |
paused
|
private IPhenotypeGenerator<T,com.jme3.scene.Geometry> |
phenotypeGenerator
|
private float |
scale
|
private float |
sceneHeight
|
private float |
sceneWidth
|
private boolean |
useCentering
|
private float |
wallHeight
|
private float |
wallThickness
|
| Fields inherited from class ga.view.appstate.SceneState |
|---|
app, assetManager, cam, inputManager, renderManager, stateManager, timer, viewPort |
| Fields inherited from class ga.view.appstate.RootNodeState |
|---|
rootNode |
| Fields inherited from class com.jme3.app.state.AbstractAppState |
|---|
initialized |
| Constructor Summary | |
|---|---|
BillardEvaluationState(IIndividualFactory<T> factory,
IPhenotypeGenerator<T,com.jme3.scene.Geometry> phenotypeGenerator)
Instantiates a new billard evaluation state. |
|
| Method Summary | |
|---|---|
void |
addEvaluationListener(EvaluationListener<T> listener)
Adds an EvaluationListener that will be notified about the
evaluation state. |
private void |
addRandomObject(float x,
float z)
Creates a random object and places it at x,y on the table. |
void |
cleanup()
|
void |
evaluate(T individual)
Evaluates the given individual. |
private com.jme3.collision.CollisionResults |
findPick(com.jme3.scene.Node node)
Finds spatials in the scene that has been clicked. |
void |
fireIndividualEvaluated(T individual)
Notification method that causes all EvaluationListeners being
notified that the evaluator has evaluated the individual. |
void |
fireNewIndividualRequested()
Notification method that causes all EvaluationListeners being
notified that the evaluator demands a new individual for evaluation. |
ISIGA<T> |
getAlgorithm()
Getter for the interactive genetic algorithm. |
private com.jme3.bullet.PhysicsSpace |
getPhysicsSpace()
Getter for the physics space. |
private void |
initCam()
Inits the camera. |
void |
initialize(com.jme3.app.state.AppStateManager stateManager,
com.jme3.app.Application app)
|
private void |
initObjects()
Inits the objects on the table. |
private void |
initTable()
Make a solid floor and add it to the scene. |
void |
removeEvaluationListener(EvaluationListener<T> listener)
Adds an EvaluationListener. |
void |
setAlgorithm(ISIGA<T> siga)
Sets the interactive genetic algorithm. |
void |
setEnabled(boolean enabled)
|
void |
setMenuListener(MenuListener menuListener)
Sets the menu listener. |
void |
setPaused(boolean paused)
Pauses the rendering and physics calculation. |
void |
update(float tpf)
|
| Methods inherited from class ga.view.appstate.SceneState |
|---|
finalCleanUp, getCamera |
| Methods inherited from class ga.view.appstate.RootNodeState |
|---|
getRootNode |
| Methods inherited from class com.jme3.app.state.AbstractAppState |
|---|
isEnabled, isInitialized, postRender, render, stateAttached, stateDetached |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger LOGGER
private com.jme3.scene.Node objectsNode
private final com.jme3.bullet.BulletAppState bulletAppState
private BillardEvaluationState.ClickListener dragListener
private final float scale
private final float sceneHeight
private float sceneWidth
private final float wallHeight
private final float wallThickness
private ISIGA<T extends IAgeIndividual<T>> algorithm
private final IPhenotypeGenerator<T extends IAgeIndividual<T>,com.jme3.scene.Geometry> phenotypeGenerator
private final IIndividualFactory<T extends IAgeIndividual<T>> factory
private MenuListener menuListener
private final java.util.List<EvaluationListener<T extends IAgeIndividual<T>>> listeners
private final java.util.Map<T extends IAgeIndividual<T>,BillardObjectNode<T extends IAgeIndividual<T>>> nodeMap
private boolean paused
private boolean useCentering
private boolean debug
| Constructor Detail |
|---|
public BillardEvaluationState(IIndividualFactory<T> factory,
IPhenotypeGenerator<T,com.jme3.scene.Geometry> phenotypeGenerator)
factory - the factoryphenotypeGenerator - the phenotype generator| Method Detail |
|---|
public void initialize(com.jme3.app.state.AppStateManager stateManager,
com.jme3.app.Application app)
initialize in interface com.jme3.app.state.AppStateinitialize in class SceneStatepublic void cleanup()
cleanup in interface com.jme3.app.state.AppStatecleanup in class RootNodeStatepublic void setEnabled(boolean enabled)
setEnabled in interface com.jme3.app.state.AppStatesetEnabled in class SceneStatepublic void update(float tpf)
update in interface com.jme3.app.state.AppStateupdate in class RootNodeStatepublic void setPaused(boolean paused)
paused - the new paused flag.public void setAlgorithm(ISIGA<T> siga)
IInteractiveFitnessEvaluator
setAlgorithm in interface IInteractiveFitnessEvaluator<T extends IAgeIndividual<T>>siga - The SIGA.public ISIGA<T> getAlgorithm()
IInteractiveFitnessEvaluator
getAlgorithm in interface IInteractiveFitnessEvaluator<T extends IAgeIndividual<T>>private void initCam()
private void initTable()
private void initObjects()
private void addRandomObject(float x,
float z)
x - The x location.z - The y location.private com.jme3.collision.CollisionResults findPick(com.jme3.scene.Node node)
node - The parent node to check for clicks.
private com.jme3.bullet.PhysicsSpace getPhysicsSpace()
public void fireNewIndividualRequested()
IInteractiveFitnessEvaluatorEvaluationListeners being
notified that the evaluator demands a new individual for evaluation.
fireNewIndividualRequested in interface IInteractiveFitnessEvaluator<T extends IAgeIndividual<T>>public void fireIndividualEvaluated(T individual)
IInteractiveFitnessEvaluatorEvaluationListeners being
notified that the evaluator has evaluated the individual.
fireIndividualEvaluated in interface IInteractiveFitnessEvaluator<T extends IAgeIndividual<T>>individual - The evaluated individual.public void addEvaluationListener(EvaluationListener<T> listener)
IInteractiveFitnessEvaluatorEvaluationListener that will be notified about the
evaluation state.
addEvaluationListener in interface IInteractiveFitnessEvaluator<T extends IAgeIndividual<T>>listener - The listener.public void removeEvaluationListener(EvaluationListener<T> listener)
IInteractiveFitnessEvaluatorEvaluationListener.
removeEvaluationListener in interface IInteractiveFitnessEvaluator<T extends IAgeIndividual<T>>listener - The listener.public void evaluate(T individual)
IFitnessEvaluator
evaluate in interface IFitnessEvaluator<T extends IAgeIndividual<T>>evaluate in interface IInteractiveFitnessEvaluator<T extends IAgeIndividual<T>>individual - Individual to evaluate.public void setMenuListener(MenuListener menuListener)
IMenuListenerParent
setMenuListener in interface IMenuListenerParentmenuListener - the new menu listener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||